﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;

namespace HigLabo.Net.Twitter
{
    public partial class TwitterClient
    {
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public DirectMessageCollection GetDirectMessageList()
        {
            return this.GetDirectMessageList(null as GetDirectMessageListCommand);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public DirectMessageCollection GetDirectMessageList(GetDirectMessageListCommand command)
        {
            String jsonText = this.GetResultText(TwitterApiUrl.Version1_1.DirectMessages.DirectMessagesUrl, command);
            return new DirectMessageCollection(jsonText);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public DirectMessageCollection GetDirectMessageListSent()
        {
            return this.GetDirectMessageListSent(null as GetDirectMessageListCommand);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public DirectMessageCollection GetDirectMessageListSent(GetDirectMessageListSentCommand command)
        {
            String jsonText = this.GetResultText(TwitterApiUrl.Version1_1.DirectMessages.DirectMessagesSentUrl, command);
            return new DirectMessageCollection(jsonText);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public DirectMessage DestroyDirectMessage(Int64 id)
        {
            return DestroyDirectMessage(new DestroyDirectMessageCommand() { ID = id });
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public DirectMessage DestroyDirectMessage(DestroyDirectMessageCommand command)
        {
            String jsonText = this.GetResultText(HttpMethodName.Post, TwitterApiUrl.Version1_1.DirectMessages.DestroyFormatUrl, command);
            return new DirectMessage(jsonText);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="text"></param>
        /// <returns></returns>
        public DirectMessage NewDirectMessage(Int64 userID, String text)
        {
            var cm = new NewDirectMessageCommand();
            cm.UserID = userID;
            cm.Text = text;
            return this.NewDirectMessage(cm);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public DirectMessage NewDirectMessage(NewDirectMessageCommand command)
        {
            String jsonText = this.GetResultText(HttpMethodName.Post, TwitterApiUrl.Version1_1.DirectMessages.NewUrl, command);
            return new DirectMessage(jsonText);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public DirectMessageCollection GetDirectMessagesByID(Int64 id)
        {
            return this.GetDirectMessagesByID(new GetDirectMessageCommand() { ID = id });
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public DirectMessageCollection GetDirectMessagesByID(GetDirectMessageCommand command)
        {
            String jsonText = this.GetResultText(TwitterApiUrl.Version1_1.DirectMessages.GetDirectMessagesShowUrl, command);
            return new DirectMessageCollection(jsonText);
        }
    }
}
